package Project;

import static org.junit.Assert.*;

import java.awt.Color;

import org.junit.Test;
import Hulppakket.*;
public class SphereTest {

	@Test
	public void test() {
		testIntersection();
	}
	
	public void testIntersection()
	{
		Sphere s = new Sphere(1,new Point3f(0,0,0),new Color3f(Color.black));
		Ray r = new Ray(new Point3f(-10,0,0),new Vector3f(1,0,0));
		Hitrecord h = new Hitrecord();
		boolean hit = s.hit(r, 0, 10000, h);
		if(hit==false) fail("No hit!");
		r.setDirection(new Vector3f(1,1,1));
		hit = s.hit(r, 0, 10000, h);
		if(hit==true) fail("false hit!");
		r.setDirection(new Vector3f(1,1/20,1/20));
		hit = s.hit(r, 0, 10000, h);
		if(hit==false) fail("NO hit!");


		
	}

}
